package com.magina.common.constant;

import com.magina.common.exception.BusinessException;

import java.text.DateFormat;
import java.text.SimpleDateFormat;

public class DateFormatUtil {
    private static final String STANDARM_DATE_FORMAT = "yyyy-MM-dd";

    private static DateFormat format = new SimpleDateFormat(STANDARM_DATE_FORMAT);

    public static String Str2DateStr(Object dateStr) throws BusinessException {
        try{
            return format.format(dateStr);
        }catch (Exception e){
            throw new BusinessException(e.getMessage());
        }

    }

}
